<template>
  <div v-if="messageType === 'border'" class="message border" :class="[messageClassName]">
    <img :src="messageImgSrc" alt="">
    <div class="message-content">
      <span class="message-number">{{messageNumber}}<i>{{messageUnit}}</i></span>
      <span class="message-name">{{messageName}}</span>
    </div>
  </div>
  <div v-else class="message" :class="[messageClassName]">
    <div class="message-content">
      <span class="message-name">{{messageName}}:</span>
      <span class="message-number">{{messageNumber}}<i>{{messageUnit}}</i></span>
    </div>
  </div>
</template>
<script>
export default {
  name: 'message',
  props: {
    messageType: {
      type: String,
      default: 'border'
    },
    messageImgSrc: {
      type: String,
      default: require('./../../../assets/images/module/message.png')
    },
    messageName: {
      type: [Number, String],
      required: true
    },
    messageNumber: {
      type: [Number, String],
      required: true
    },
    messageUnit: {
      type: String,
      default: ''
    },
    messageClassName: {
      type: [Object, String],
      default: ''
    }
  },
  data () {
    return {
    }
  },
  methods: {
  },
  mounted () {
  }
}
</script>

<style lang="scss" scoped>
  .message {
    position: relative;
    &.negative{
      .message-content {
        span {
          &.message-number {
            color: #31e883;
          }
        }
      }
    }
    &.positive{
      .message-content {
        span {
          &.message-number {
            color: #e03f7b;
          }
        }
      }
    }
    &.border{
      .message-content{
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        align-items: center;
        align-content: center;
        span{
          display: block;
          text-align: center;
          width: 100%;
          &.message-number {
            margin-bottom: 2px;
          }
        }
      }
    }
    img {
      display: block;
      width: 100%;
    }
    .message-content {
      span {
        font-size: 12px;
        color: #72ACEC;
        line-height: 12px;
        height: 12px;
        &.message-number {
          line-height: 20px;
          height: 20px;
          font-size: 20px;
          color: #fff;
        }
      }
    }
  }
@media screen and (min-width: 1890px) {
  .message {
    &.border{
      .message-content{
        span{
          &.message-number {
            margin-bottom: 5px;
          }
        }
      }
    }
    .message-content {
      span {
        font-size: 16px;
        line-height: 16px;
        height: 16px;
        &.message-number {
          font-size: 26px;
          height: 26px;
          line-height: 26px;
        }
      }
    }
  }
}
</style>
